home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 2000 August: Tool Chest / Dev.CD Aug 00 TC Disk 2.toast / pc / sample code / human interface toolbox / modeless dialog sample / sampleheader.h < prev   
Encoding:
C/C++ Source or Header  |  2000-06-23  |  2.8 KB  |  132 lines

  1. /*
  2.     File:        SampleHeader.h
  3.  
  4.     Contains:    a sample application showing how to implement a 
  5.                 modeless dialog with a couple of controls.
  6.  
  7.     Written by: Nitin Ganatra    
  8.  
  9.     Copyright:    Copyright © 1994-1999 by Apple Computer, Inc., All Rights Reserved.
  10.  
  11.                 You may incorporate this Apple sample source code into your program(s) without
  12.                 restriction. This Apple sample source code has been provided "AS IS" and the
  13.                 responsibility for its operation is yours. You are not permitted to redistribute
  14.                 this Apple sample source code as "Apple sample source code" after having made
  15.                 changes. If you're going to re-distribute the source, we require that you make
  16.                 it clear in the source that the code was descended from Apple sample source
  17.                 code, but that you've made changes.
  18.  
  19.     Change History (most recent first):
  20.                 8/9/1999    Karl Groethe    Updated for Metrowerks Codewarror Pro 2.1
  21.                 
  22.  
  23. */
  24.  
  25. #ifndef __QUICKDRAW__
  26. #include <QuickDraw.h>
  27. #endif
  28.  
  29. #ifndef __DIALOGS__
  30. #include <Dialogs.h>
  31. #endif
  32.  
  33. #ifndef __FONTS__
  34. #include <Fonts.h>
  35. #endif
  36.  
  37. #ifndef __PROCESSES__
  38. #include <Processes.h>
  39. #endif
  40.  
  41. #ifndef __TEXTEDIT__
  42. #include <TextEdit.h>
  43. #endif
  44.  
  45. #ifndef __MENUS__
  46. #include <Menus.h>
  47. #endif
  48.  
  49. #ifndef __MEMORY__
  50. #include <Memory.h>
  51. #endif
  52.  
  53. #ifndef __ERRORS__
  54. #include <Errors.h>
  55. #endif
  56.  
  57. #ifndef __SCRAP__
  58. #include <Scrap.h>
  59. #endif
  60.  
  61. #ifndef __TOOLUTILS__
  62. #include <ToolUtils.h>
  63. #endif
  64.  
  65. #ifndef __WINDOWS__
  66. #include <Windows.h>
  67. #endif
  68.  
  69. #ifndef __TEXTUTILS__
  70. #include <TextUtils.h>
  71. #endif
  72.  
  73. enum {
  74.     kMenuBarResID = 128,
  75.     kAboutBoxDITLID = 128,
  76.     kModelessDialogID = 200
  77. };
  78.  
  79. enum {
  80.     kOkayButton = 1,
  81.     kCancelButton,
  82.     kEditCheckItem,
  83.     kEditTextField,
  84.     kEditUserItem,
  85.     kOkayUserItem
  86. };
  87.  
  88. enum {
  89.     kCutItem = 1,
  90.     kCopyItem,
  91.     kPasteItem,
  92.     kClearItem,
  93.     kAppleMenu = 128,
  94.     kFileMenu,
  95.     kEditMenu
  96. };
  97.  
  98. enum {
  99.     kNewItem = 1,
  100.     kQuitItem
  101. };
  102.  
  103. void InitApplication(void);
  104. void MyCreateNewWindow(void);
  105. void MainEventLoop(void);
  106. Boolean MenuCommand(long);
  107. void DoAboutBox(void);
  108. void PreEventLoop(void);
  109. void PostEventLoop(void);
  110. pascal void DrawWindowContent(short, short, GDHandle, long);
  111. void DrawIt(WindowPtr);
  112. void DoUpdate(WindowPtr);
  113. void AdjustMenus(void);
  114.  
  115. Boolean EventFilter(EventRecord *theEvent, WindowPtr theFrontWindow);
  116. void CreateModelessDialog(void);
  117. void DoDialogEvent(EventRecord *);
  118. void DoDialogNullEvent(EventRecord *);
  119. void DoCut(DialogPtr);
  120. void DoCopy(DialogPtr);
  121. void DoPaste(DialogPtr);
  122. void DoClear(DialogPtr);
  123.  
  124. static void HiliteAllControls(DialogPtr, short);
  125. static void DisableDialogControl(DialogPtr, short);
  126. static void SetDialogControlHilite(DialogPtr, short, Boolean);
  127. static ControlHandle GetCtlHandle(DialogPtr, short);
  128. static void InvalThisItemRect(DialogPtr, short);
  129. static void FakeButtonHilite(DialogPtr, short);
  130. static pascal void DrawButtonBorder(WindowPtr, short);
  131. static pascal void DimEditLine(WindowPtr, short);
  132.